﻿using System;
using System.Windows.Forms;
using ScapLIB;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        ScapCapture Cap = new ScapCapture(true, 5);

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ScapCore.StartCapture();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ScapCore.StopCapture();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ScapCore.DecompressCapture(false);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            ScapCore.EncodeCapture(false);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text = "Frame Count: " + ScapCore.GetCaptureCount().ToString();
            label2.Text = "FPS: " + ScapCore.GetActualFPS().ToString();
            DecompProgressBar.Value = (int)(ScapCore.GetDecompressionProgress() * 100);
            EncodeProgressBar.Value = (int)(ScapCore.GetEncodeProgress() * 100);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            ScapBackendConfig.ScapBackendSetup(Cap);
            timer1.Interval = 10;
            timer1.Enabled = true;
            DecompProgressBar.Maximum = 100;
            EncodeProgressBar.Maximum = 100;
        }
    }
}
